"""
DB操作库
"""

from users.models import UserProfile


def get_user(user_id: int) -> UserProfile:
    """
    通过用户ID获取用户
    """
    user: UserProfile = UserProfile.get(user_id)
    return user


def get_user_by_phone(phone: str) -> UserProfile:
    """
    通过手机号获取用户
    """
    user: User = User.filter_by(phone=phone).first()
    return user
